home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 20
/
Cream of the Crop 20 (Terry Blount) (1996).iso
/
image
/
savers_.zip
/
BGI256.DOC
< prev
next >
Wrap
Text File
|
1993-04-24
|
53KB
|
1,404 lines
BGI256 driver
Copyright 1991,1993 Knight Software
as of 17 Apr 1993
The BGI256 driver is a BGI driver for Super VGA cards using
256 colors. The most popular 256 color modes are supported.
With this release of the driver, protected mode operation is now
supported.
Mode Description Memory Who uses it
0 320x200x256 : (64K) Standard VGA and MCGA
1 640x400x256 : (256K) Some Super VGAs
2 640x480x256 : (512K) Most Super VGAs
3 800x600x256 : (512K/1M) Some Super VGAs
4 1024x768x256 : (1M) Some Super VGAs
5 1280x1024x256 : (2M) Some Super VGAs
The BGI256 driver supports most of the Graphics commands with a
few exceptions. Additionally, I have added some extensions to the
capabilities of the BGI driver beyond the functionality of the
standard BGI drivers. These extensions do not affect the normal
use of the BGI driver with regular programs. The extensions allow
for greater flexibility in the use of the driver and various
drawing functions.
The driver works with the standard Borland graphics commands. For
the operation of the graphics commands refer to your Pascal or C
language reference manual.
It should be noted that the BGI driver was originally designed
for use with the Hercules, CGA and EGA displays. It does not have
full support capability for VGA type displays, and in fact has
some limitations placed on it by the EGA specific code. Every
attempt was made to keep the operation as similar as possible to
the Borland supplied BGI drivers, but because of the limitations
imposed by Borland's GRAPH code some functions do not work
exactly the same, or do not work at all.
The following list of commands describe the exceptions or
limitations of the graphics commands that are not fully
supported, supported differently, or have been extended in this
driver. Graphics functions that are not listed here continue to
operate exactly as specified in the language reference manual.
1
Pascal: function AutoDetect : integer;
C, C++: int huge autodetect(void);
The AutoDetect function is not a library function but rather code
that you must write yourself if you are going to be using
autodetection for a non-Borland supplied BGI driver. You can
label the function any name that you wish as long as you pass a
pointer to the function to the InstallUserDriver when it is
called. If you are not going to be supplying an autodetect
function, then you should pass a nil pointer to the
InstallUserDriver function.
Note: In TP5.0 and TP5.5 you must use the Autodetection method
due to a bug in the graph unit which causes the InstallUserDriver
function to return a bad number.
The AutoDetect function can be used to determine if the hardware
is installed in the computer, and the Borland manuals indicate
that this is it's function. I consider this poor practice however
since it places hardware dependent code in the main program which
defeats the purpose of the BGI driver which is to remove hardware
dependencies from the main program code. The BGI256 driver
provides the hardware detection as a part of the driver itself.
The detection is performed during the InitGraph (and as a side
effect in the SetGraphMode function).
Normally you would pass the mode selection that you wish the
display to start up in. Sometimes that is not always possible,
especially with the Super VGA displays where you cannot be
certain what modes are available until the display has been
initialized with the InitGraph function.
To solve that problem, if a mode value that is outside the range
of available modes is passed to the driver it will go into
auto-mode detection. This will cause the driver to ignore the
mode value and place the driver into the default mode. This
prevents setting the display to a non-supported mode while still
allowing the main program to be non-hardware specific.
The only problem with this is that the GRAPH unit will think that
the mode selected is 127. To get around this limitation, an
extended function has been provided to cause the GetMaxMode
function to return the currently selected mode by calling
SetWriteMode($E0+25) before calling GetMaxMode. The GetGraphMode
function will not contain a proper value until a SetGraphMode
call is made with a supported mode passed as the mode value.
Because of this, it is recommended that the GetMaxMode method be
used if you use the auto-mode detection scheme.
The same effect will occur if you pass the auto-mode value as a
mode value to the InitGraph function along with the desired
Driver number, or if the driver is unable to select the mode that
is passed. In all cases the grInvalidMode error will be returned.
2
-----------------------------------------------------------------
Pascal: procedure DetectGraph
(var GraphDriver, GraphMode : integer);
C, C++: void far detectgraph
(int far *graphdriver, int far *graphmode);
The DetectGraph function is used to detect the presence of one of
the standard Borland supported display cards. This function will
NOT call the AutoDetect function addressed by the
InstallUserDriver function. If you wish to detect the presence of
a non-Borland supplied driver, then you must first call the
appropriate AutoDetect routine yourself.
This function doesn't normally have to be used unless you wish to
override the driver/mode numbers normally determined by the
detection function and you intend to use one of the Borland
supplied BGI drivers.
The DetectGraph function is automatically called by the InitGraph
function when the GraphDriver number passed is zero. If you call
DetectGraph yourself, the number provided in GraphDriver is
ignored, and the number for the Borland supplied driver that fits
the determined display card is passed back in GraphDriver
variable. The Mode number is set to the maximum mode number that
is available for the detected display system. These numbers can
then be used with the InitGraph function to actually initialize
the graphics system.
If you wish to autodetect the BGI256 driver, then you must call
your own AutoDetect routine to test for the driver before
attempting to call the DetectGraph function. If you don't do
this, then this driver will not be detected.
See also:
AutoDetect, InitGraph, RegisterBGIdriver, InstallUserDriver
3
-----------------------------------------------------------------
Pascal: procedure FloodFill(X, Y : integer; Border : word);
C, C++: void far floodfill(int x, int y, int border);
The Floodfill function is now fully supported in V3.00. You can
select either Border Fill (default), or Seed Fill operation. The
FillPattern controls the floodfill color and pattern that will be
used (see SetFillPattern